package config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;
import study.MyStudy;
import study.Study;
import study.StudyAspect;

/**
 * javaConfig配置
 * 这个是root配置
 */
@Configuration
@EnableAspectJAutoProxy //启用AspectJ自动代理
@ComponentScan(basePackageClasses = Study.class)//开启自动扫描
@PropertySource("classpath:app.properties")
public class StudyConfig {

    @Autowired
    private Environment env;

    @Bean(name = "javaStudy")
    public Study study(){
        System.out.println(env!=null?env.toString():"null");
        return new MyStudy(env.getProperty("book.title"));
    }
}
